package br.cin.stadium.middleware.event;


/**
 * This class represents an Event that shall be exchanged between 
 * Network layer and all Business layers that can be found in StadiumMiddleware.
 * 
 * @author Fabiano, Jorge, Rafael and Vando
 *
 */
public class EventMiddleware {
	
	
	/**
	 * Represents socket id associate when event is from network layer
	 */
	private int socketId;

	/**
	 * Opcode for the current event
	 */
	private int opCode;

	/**
	 * Wrapper for parameters passed in the Event.
	 */
	private Object[] parameters;

	/**
	 * Byte array to abstract content transfered
	 */
	private byte[] data;

	/**
	 * Indicate how many times EventManager tried to send this event
	 */
	private int counter = 0;
	
	/**
	 * Constructor that receives socketId and opCode
	 * 
	 * @param socketId
	 * @param type
	 */
	public EventMiddleware(int socketId, int opCode) {
		this(socketId, opCode, null);
	}
	
	/**
	 * Constructor that receives socketId, opCode, and parameters
	 * 
	 * @param socketId
	 * @param opCode
	 * @param parameter
	 */
	public EventMiddleware(int socketId, int opCode, Object[] parameter) {
		this.socketId = socketId;
		this.opCode = opCode;
		this.parameters = parameter;
	}
	
	/**
	 * Constructor that receives socketId, opCode, Object parameters and byte data array.
	 * 
	 * @param socketId
	 * @param opCode
	 * @param parameter
	 * @param data
	 */
	public EventMiddleware(int socketId, int opCode, Object[] parameter, byte[] data) {
		this.socketId = socketId;
		this.opCode = opCode;
		this.parameters = parameter;
		this.data = data;
	}

	public int getSocketId() {
		return socketId;
	}


	public int getOpCode() {
		return this.opCode;
	}
	
	public byte[] getData() {
		return this.data;
	}
	
	public void setData(byte[] data) {
		this.data = data;
	}

	public int getCounter() {
		return counter;
	}

	public void setCounter(int counter) {
		this.counter = counter;
	}

	public Object[] getParameter() {
		return parameters;
	}

	public void setParameter(Object[] parameter) {
		this.parameters = parameter;
	}

}
